package com.example.personordersystem.dbHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class DBOpenHelper extends SQLiteOpenHelper {
	private static final String NAME = "data.db";
	private static int VERSION = 1;
	private static final String TABLENAME = "t_Food";

	public DBOpenHelper(Context context) {
		super(context, NAME, null, VERSION);
	}

	public DBOpenHelper(Context context, String colnum) {
		super(context, NAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {

		db.execSQL("create table t_Food(id integer primary key autoincrement,createdate datetime  ,foodName varchar(20),foodSupport varchar(100),foodContent varchar(255),hard varchar(10)) ");
	}

	@Override
	public void onOpen(SQLiteDatabase db) {
		super.onOpen(db);
		VERSION = db.getVersion();
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		String sql = "ALTER TABLE " + TABLENAME + " column_name " + "";
		db.execSQL(sql);

	}

	public boolean deleteDatabase(Context context) {

		return context.deleteDatabase(NAME);

	}

}
